/*
 * @Author: Joel
 * @Date: 2025-04-10 14:05:53
 * @LastEditors: Joel
 * @LastEditTime: 2025-04-14 16:31:09
 * @FilePath: /gd32f303cct6/usr/board_driver/control.h
 * @Description:
 * Copyright (C) 2025 YiJiaLink, All Rights Reserved.
 * 2025-04-10 14:05:53
 */
#ifndef __CONTROL_H
#define __CONTROL_H

/* 包含头文件代码 */

#include "gd32f30x.h"
#include "systick.h"

#if defined(__cplusplus)
extern "C"
{
#endif /*_cplusplus*/

    enum CTRL_OUTPUT
    {
        PWR_CTRL,
        VALVE_CTRL,
        FSTCH_CTRL,
        EMS_CTRL,
        OLED_RES,
        OLED_DC,
        OLED_CS,
        IR_CTRL,
        CTRL_MAX
    };
#define    CTRLA_RCU RCU_GPIOA
#define    CTRLB_RCU RCU_GPIOB
/*PWR_CTRL 硬件连接 */
#define PWR_CTRL_GPIO_PORT GPIOB
#define PWR_CTRL_PIN GPIO_PIN_10

/*VALVE_CTRL 硬件连接 */
#define VALVE_CTRL_GPIO_PORT GPIOB
#define VALVE_CTRL_PIN GPIO_PIN_11

/*FSTCH_CTRL 硬件连接 */
#define FSTCH_CTRL_GPIO_PORT GPIOB
#define FSTCH_CTRL_PIN GPIO_PIN_12

/*EMS_CTRL 硬件连接 */
#define EMS_CTRL_GPIO_PORT GPIOB
#define EMS_CTRL_PIN GPIO_PIN_9

/*OLED_RES 硬件连接 */
#define OLED_RES_GPIO_PORT GPIOB
#define OLED_RES_PIN GPIO_PIN_3

/*OLED_DC 硬件连接 */
#define OLED_DC_GPIO_PORT  GPIOA
#define OLED_DC_PIN  GPIO_PIN_6

/*OLED_CS 硬件连接 */
#define OLED_CS_GPIO_PORT  GPIOB
#define OLED_CS_PIN  GPIO_PIN_4

/*IR_CTRL 硬件连接 */
#define IR_CTRL_GPIO_PORT GPIOA
#define IR_CTRL_PIN GPIO_PIN_15

    /* 功能打包 */
    struct ctrl_func
    {
        /* data */
        void (*device_init)(void);
        void (*ctrl_run)(enum CTRL_OUTPUT ctrl,uint8_t flag);
        void (*ctrl_stop)(enum CTRL_OUTPUT ctrl);

    };

    struct ctrl_func *ctrl_driver_init(void);

#if defined(__cplusplus)
}
#endif /*_cplusplus*/

#endif
/* el psy congroo */
